import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
let kejianrouter = new Router({
  routes: [{
    path: '/',
    name: 'home',
    component: () => import('./views/Home.vue')
  },
  {
    path: '/news',
    name: 'news',
    component: () => import('./views/News.vue'),
  },
  {
    path: '/overview',
    name: 'overview',
    component: () => import('./views/overview.vue'),
  },
  {
    path: '/solution',
    name: 'solution',
    component: () => import('./views/solution.vue')
  },
  {
    path: '/contact',
    name: 'contact',
    component: () => import('./views/contact.vue')
  },
  {
    path: '/download',
    name: 'download',
    component: () => import('./views/downLoad.vue')
  },
  {
    path: '/tellme',
    name: 'tellme',
    component: () => import('./views/tellme.vue')
  },
  {
    path: '/pageDetail',
    name: 'pageDetail',
    component: () => import('./views/pageDetail.vue')
  },

  ]
})

// 判断是否需要登录权限 以及是否登录
// kejianrouter.beforeEach((to, from, next) => {
//   // 判断是否需要登录权限
//   if (to.matched.some(res => res.meta.requireAuth)) {
//     // 判断是否登录
//     if (sessionStorage.getItem('token')) {
//       next()
//     } else {
//       // 没登录则跳转到登录界面
//       next({
//         path: '/login',
//         query: {
//           redirect: to.fullPath
//         }
//       })
//     }
//   } else {
//     next()
//   }
// })

export default kejianrouter